home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / TDE200.ARJ / TDECFG.H < prev    next >
C/C++ Source or Header  |  1992-06-05  |  15KB  |  459 lines

  1. /********    EXTREMELY IMPORTANT   ************/
  2. /*
  3.  * If you modify tde, it is your responsibility to find the offset of
  4.  * the key definition array in your new executable, tde.exe.
  5.  *
  6.  */
  7.  
  8. #define  COLOR_OFFSET   81048l
  9. #define  HELP_OFFSET    78946l
  10. #define  KEYS_OFFSET    78088l
  11. #define  MACRO_OFFSET   73232l
  12. #define  MODE_OFFSET    72942l
  13.  
  14. /********    EXTREMELY IMPORTANT   ************/
  15.  
  16.  
  17. #define TRUE            1
  18. #define FALSE           0
  19.  
  20. #define OK              0
  21. #define ERROR           (-1)
  22.  
  23.  
  24. #define MAX_KEYS        256
  25. #define AVAIL_KEYS      233
  26.  
  27.  
  28. #define STROKE_LIMIT    1024
  29.  
  30.  
  31. #define NUM_FUNC        122
  32.  
  33. #define NUM_COLORS      12
  34.  
  35. #define NUM_MODES       17
  36.  
  37. /*
  38.  * mode indexes
  39.  */
  40. #define Ins     0 
  41. #define Ind     1 
  42. #define TAB     2
  43. #define Smart   3 
  44. #define Write_Z 4 
  45. #define Crlf    5 
  46. #define Trim    6 
  47. #define Eol     7 
  48. #define WW      8 
  49. #define Left    9 
  50. #define Para    10
  51. #define Right   11
  52. #define Size    12
  53. #define Backup  13
  54. #define Ruler   14
  55. #define Date    15
  56. #define Time    16
  57.  
  58.  
  59.  
  60. #define EXIST           0
  61.  
  62. #define VIDEO_INT       0x10
  63.  
  64. #define VGA             3
  65. #define EGA             2
  66. #define CGA             1
  67. #define MDA             0
  68.  
  69. #define NORMAL          7
  70. #define COLOR_ATTR      31
  71. #define MONO_ATTR       112
  72.  
  73.  
  74. #define ESC             27
  75. #define LEFT            (75 | 0x100)
  76. #define RIGHT           (77 | 0x100)
  77. #define UP              (72 | 0x100)
  78. #define DOWN            (80 | 0x100)
  79. #define RTURN           13
  80. #define PGUP            (73 | 0x100)
  81. #define PGDN            (81 | 0x100)
  82. #define F1              (59 | 0x100)
  83. #define F2              (60 | 0x100)
  84. #define F3              (61 | 0x100)
  85. #define F5              (63 | 0x100)
  86. #define F6              (64 | 0x100)
  87. #define F7              (65 | 0x100)
  88. #define F8              (66 | 0x100)
  89. #define F10             (68 | 0x100)
  90.  
  91.  
  92. #define U_LEFT          218
  93. #define U_RIGHT         191
  94. #define VER_LINE        179
  95. #define HOR_LINE        196
  96. #define L_LEFT          192
  97. #define L_RIGHT         217
  98.  
  99. #define SAVE            0
  100. #define RESTORE         1
  101.  
  102.  
  103. /*
  104.  * Save the underlying text of the screen in a structure.  We need to know
  105.  * the column and row to begin saving the text.  Since we are doing an
  106.  * optimal save and restore, we don't know how much memory to allocate to
  107.  * the save buffer.  If we use a pointer, then we can dynamically allocate as
  108.  * much or as little memory as we need.  Finally, we need a window pointer
  109.  * to point to the next item on the stack.
  110.  */
  111. typedef struct win {
  112.    int x;
  113.    int y;
  114.    int *buf;
  115.    struct win *n;
  116. } WINDOW;
  117.  
  118.  
  119. /*
  120.  * Structure to store the row and column of a string.
  121.  */
  122. struct screen {
  123.    unsigned int   row;
  124.    unsigned int   col;
  125.    unsigned char *text;
  126. };
  127.  
  128.  
  129. /*
  130.  * video adapter stuff.
  131.  */
  132. struct vcfg {
  133.    int color;
  134.    int rescan;
  135.    int mode;
  136.    int adapter;
  137.    int attr;
  138.    int far *videomem;
  139. };
  140.  
  141.  
  142. /*
  143.  * When we display a pop-up or pull-down window, we need to know a few things
  144.  * about the window and the text to display in the window.
  145.  */
  146. typedef struct {
  147.    int dply_col;        /* offset into window to begin displaying help list */
  148.    int dply_row;        /* dito */
  149.    int line_length;     /* the length of the help line in the window */
  150.    int avail_lines;     /* number of lines in the window available for list */
  151.    int v_row;           /* virtual row of cursor in window */
  152.    int select;          /* item currently selected in help list */
  153.    int num_entries;     /* total number of items in help list */
  154.    int ulft_col;        /* absolute upper left column of window */
  155.    int ulft_row;        /* absolute upper left row of window */
  156.    int total_col;       /* total number of columns in window */
  157.    int total_row;       /* total number of rows in window */
  158. } HELP_WINDOW;
  159.  
  160.  
  161. /*
  162.  * structure for list of available keys.   See default.h for more info.
  163.  */
  164. typedef struct {
  165.    char *key;           /* key name */
  166.    int  key_index;      /* offset into key structure in tde.exe file */
  167.    unsigned char func_index;     /* function of key */
  168. } KEY_DEFS;
  169.  
  170.  
  171. /*
  172.  * structure for list of available keys.   See default.h for more info.
  173.  */
  174. typedef struct {
  175.    char *key;           /* key name */
  176.    int  key_index;      /* offset into key structure in tde.exe file */
  177. } CONFIG_DEFS;
  178.  
  179.  
  180. /*
  181.  * From the source code of tde.
  182.  */
  183. typedef struct {
  184.   int key;      /* key assinged to this node, which may be text or function */
  185.   int next;     /* pointer to next node in macro def */
  186. } STROKES;
  187.  
  188. /*
  189.  * structure for the macro buffer.
  190.  */
  191. typedef struct {
  192.    int  first_stroke[MAX_KEYS];         /* pointer to first key in macro */
  193.    STROKES strokes[STROKE_LIMIT];       /* buffer to hold key strokes */
  194. } MACRO;
  195.  
  196.  
  197.  
  198. /*
  199.  * "mode_infos" contain the editor mode variables.  The configuration
  200.  *  utility modifies this structure to custimize the start-up tde
  201.  *  configuration
  202.  */
  203. typedef struct {
  204.    int  color_scheme;           /* color to start out with */
  205.    int  sync;                   /* sync the cursor movement command? */
  206.    int  sync_sem;               /* sync the cursor movement command? */
  207.    int  record;                 /* are we recording keystrokes? */
  208.    int  insert;                 /* in insert mode? */
  209.    int  indent;                 /* in auto-indent mode? */
  210.    int  tab_size;               /* characters between tab stops */
  211.    int  smart_tab;              /* smart tab mode on or off? */
  212.    int  enh_kbd;                /* type of keyboard */
  213.    int  cursor_size;            /* insert cursor big or small? */
  214.    char *eof;                   /* message to display at end of file */
  215.    int  control_z;              /* write ^Z - t or f */
  216.    int  crlf;                   /* <cr><lf> toggle CRLF or LF */
  217.    int  trailing;               /* remove trailing space? T or F */
  218.    int  show_eol;               /* show lf at eol? T or F */
  219.    int  word_wrap;              /* in word wrap mode? */
  220.    int  left_margin;            /* left margin */
  221.    int  parg_margin;            /* column for 1st word in paragraph */
  222.    int  right_margin;           /* right margin */
  223.    int  do_backups;             /* create backup or ".bak" files? T or F */
  224.    int  ruler;                  /* show ruler at top of window? T or F */
  225.    int  date_style;             /* date style for date and time stamp */
  226.    int  time_style;             /* time style for date and time stamp */
  227. } MODE_INFO;
  228.  
  229.  
  230. /*************  prototypes for functions in  tdecfg.c  *******************/
  231. void  main( int, char *[] );
  232. void xygoto( int, int );
  233. void video_config( void );
  234. int getkey( void );
  235. void s_output( char far *, int, int, int );
  236. void cls( void );
  237. void hlight_line( int, int, int, int );
  238. void c_off( void );
  239. void c_on( void );
  240. void scroll_window( int, int, int, int, int, int );
  241. void cls( void );
  242. void show_box( int, int, struct screen *, int );
  243. void make_window( int, int, int, int, int );
  244. void buf_box( int, int, int, int, int );
  245. void clear_window( int, int, int, int );
  246. void window_control( WINDOW **, int, int, int, int, int );
  247. void save_window( int *, int, int, int, int );
  248. void restore_window( int *, int, int, int, int );
  249. /*************************************************************************/
  250.  
  251.  
  252. /*************  prototypes for functions in  cfgcolor.c  *****************/
  253. void tdecolor( void );
  254. void initialize_color( void );
  255. void show_init_sample( void );
  256. void color_number( char *, int );
  257. void current_color_number( char *, int );
  258. void show_help_color( void );
  259. void show_fileheader_color( void );
  260. void show_text_color( void );
  261. void show_curl_color( void );
  262. void show_warning_color( void );
  263. void show_mode_color( void );
  264. void show_wrapped_color( void );
  265. void show_eof_color( void );
  266. void show_ruler_color( void );
  267. void show_rulerptr_color( void );
  268. void show_block_color( void );
  269. void show_hilitedfile_color( void );
  270. void change_colors( void );
  271. /*************************************************************************/
  272.  
  273.  
  274. /*************  prototypes for functions in  cfgkeys.c  *****************/
  275. void tdekeys( void );
  276. void initialize_keys( void );
  277. void show_key_def_list( HELP_WINDOW *, KEY_DEFS * );
  278. void show_func_list( HELP_WINDOW *, char *[] );
  279. void position_cursor( HELP_WINDOW *, int, int *, int *, int * );
  280. void master_help( HELP_WINDOW *, KEY_DEFS *, struct screen *, char *, int * );
  281. void new_assignment_help( HELP_WINDOW *, char *[], struct screen *, int * );
  282. void save_and_draw( HELP_WINDOW *, struct screen *, WINDOW ** );
  283. /*************************************************************************/
  284.  
  285.  
  286. /*************  prototypes for function in  cfghelp.c  *******************/
  287. void tdehelp( void );
  288. /*************************************************************************/
  289.  
  290.  
  291. /*************  prototypes for function in  cfgmacro.c  *******************/
  292. void tdemacro( void );
  293. /*************************************************************************/
  294.  
  295.  
  296. /*************  prototypes for functions in cfgmodes.c  *****************/
  297. void tdemodes( void );
  298. void initialize_modes( void );
  299. void show_init_mode( void );
  300. void show_insert_mode( void );
  301. void show_indent_mode( void );
  302. void show_smart_mode( void );
  303. void show_tabsize( void );
  304. void show_controlz( void );
  305. void show_eol_out( void );
  306. void show_trail( void );
  307. void show_eol_display( void );
  308. void show_ww( void );
  309. void show_left( void );
  310. void show_para( void );
  311. void show_right( void );
  312. void show_cursor_size( void );
  313. void show_backup_mode( void );
  314. void show_ruler_mode( void );
  315. void show_date_style( void );
  316. void show_time_style( void );
  317. void change_modes( void );
  318. /*************************************************************************/
  319.  
  320.  
  321. /*************  prototypes for functions in cfgmodes.c  *****************/
  322. void tdecfgfile( void );
  323. void parse_line( char * );
  324. char *parse_token( char *, char * );
  325. int  search( char *, CONFIG_DEFS [], int );
  326. void parse_macro( int, char * );
  327. int  parse_literal( int, char *, char *, char ** );
  328. void initialize_macro( int );
  329. void clear_previous_macro( int );
  330. void check_macro( int );
  331. int  record_keys( int, int );
  332. int  get_stroke_count( void );
  333. int  getfunc( int );
  334. /*************************************************************************/
  335.  
  336.  
  337. #define   Help                     1
  338. #define   Rturn                    2
  339. #define   NextLine                 3
  340. #define   BegNextLine              4
  341. #define   LineDown                 5
  342. #define   LineUp                   6
  343. #define   CharRight                7
  344. #define   CharLeft                 8
  345. #define   ScrollRight              9
  346. #define   ScrollLeft              10
  347. #define   WordRight               11
  348. #define   WordLeft                12
  349. #define   ScreenDown              13
  350. #define   ScreenUp                14
  351. #define   EndOfFile               15
  352. #define   TopOfFile               16
  353. #define   BotOfScreen             17
  354. #define   TopOfScreen             18
  355. #define   EndOfLine               19
  356. #define   BegOfLine               20
  357. #define   JumpToLine              21
  358. #define   CenterWindow            22
  359. #define   CenterLine              23
  360. #define   HorizontalScreenRight   24
  361. #define   HorizontalScreenLeft    25
  362. #define   ScrollDnLine            26
  363. #define   ScrollUpLine            27
  364. #define   FixedScrollUp           28
  365. #define   FixedScrollDn           29
  366. #define   ToggleOverWrite         30
  367. #define   ToggleSmartTabs         31
  368. #define   ToggleIndent            32
  369. #define   ToggleWordWrap          33
  370. #define   ToggleCRLF              34
  371. #define   ToggleTrailing          35
  372. #define   ToggleZ                 36
  373. #define   ToggleEol               37
  374. #define   ToggleSync              38
  375. #define   ToggleRuler             39
  376. #define   SetTabs                 40
  377. #define   SetLeftMargin           41
  378. #define   SetRightMargin          42
  379. #define   SetParagraphMargin      43
  380. #define   FormatParagraph         44
  381. #define   FormatText              45
  382. #define   LeftJustify             46
  383. #define   RightJustify            47
  384. #define   CenterJustify           48
  385. #define   Tab                     49
  386. #define   BackTab                 50
  387. #define   ParenBalance            51
  388. #define   BackSpace               52
  389. #define   DeleteChar              53
  390. #define   StreamDeleteChar        54
  391. #define   DeleteLine              55
  392. #define   DelEndOfLine            56
  393. #define   WordDelete              57
  394. #define   AddLine                 58
  395. #define   SplitLine               59
  396. #define   JoinLine                60
  397. #define   DuplicateLine           61
  398. #define   AbortCommand            62
  399. #define   UndoLine                63
  400. #define   UndoDelete              64
  401. #define   ToggleSearchCase        65
  402. #define   FindForward             66
  403. #define   FindBackward            67
  404. #define   RepeatFindForward1      68
  405. #define   RepeatFindForward2      69
  406. #define   RepeatFindBackward1     70
  407. #define   RepeatFindBackward2     71
  408. #define   ReplaceForward          72
  409. #define   ReplaceBackward         73
  410. #define   MarkBox                 74
  411. #define   MarkLine                75
  412. #define   MarkStream              76
  413. #define   UnMarkBlock             77
  414. #define   FillBlock               78
  415. #define   NumberBlock             79
  416. #define   CopyBlock               80
  417. #define   KopyBlock               81
  418. #define   MoveBlock               82
  419. #define   OverlayBlock            83
  420. #define   DeleteBlock             84
  421. #define   BlockToFile             85
  422. #define   PrintBlock              86
  423. #define   BlockExpandTabs         87
  424. #define   BlockTrimTrailing       88
  425. #define   BlockUpperCase          89
  426. #define   BlockLowerCase          90
  427. #define   BlockStripHiBit         91
  428. #define   SortBoxBlock            92
  429. #define   DateTimeStamp           93
  430. #define   EditFile                94
  431. #define   DirList                 95
  432. #define   File                    96
  433. #define   Save                    97
  434. #define   SaveAs                  98
  435. #define   SetFileAttributes       99
  436. #define   EditNextFile           100
  437. #define   RedrawScreen           101
  438. #define   SizeWindow             102
  439. #define   SplitHorizontal        103
  440. #define   SplitVertical          104
  441. #define   NextWindow             105
  442. #define   PreviousWindow         106
  443. #define   ZoomWindow             107
  444. #define   NextHiddenWindow       108
  445. #define   SetMark1               109
  446. #define   SetMark2               110
  447. #define   SetMark3               111
  448. #define   GotoMark1              112
  449. #define   GotoMark2              113
  450. #define   GotoMark3              114
  451. #define   RecordMacro            115
  452. #define   PlayBack               116
  453. #define   SaveMacro              117
  454. #define   LoadMacro              118
  455. #define   ClearAllMacros         119
  456. #define   Pause                  120
  457. #define   Quit                   121
  458.  
  459.